﻿using System.Collections.Generic;

namespace Payment.Weixin2
{
    /// <summary>
    /// Sign类
    /// </summary>
    public class WxSign
    {
        private WxPackage wxPackage;
        public WxSign(WxPackage wxPackage)

        {
            this.wxPackage = wxPackage;
        } 
        public string GetSign(string key)
        {
            var d = new Dictionary<string, string>();
            d.Add("appid", wxPackage.Appid);
            d.Add("auth_code", "123456");
            d.Add("mch_id", wxPackage.Mchid);
            d.Add("nonce_str", wxPackage.NonceStr);

            d.Add("body", wxPackage.Body);
            d.Add("out_trade_no", wxPackage.OutTradeNo);
            d.Add("total_fee", wxPackage.TotalFee);
            d.Add("spbill_create_ip", wxPackage.SpbillCreateIp);
             
            var orderBy = WxCommon.GetOrderBy(d);
            var stringSignTemp = WxCommon.GetStringSignTemp(orderBy, key);
            return stringSignTemp;
        }


        /// <summary>
        /// AuthCode
        /// </summary>
        public string AuthCode { get; set; }



        /// <summary>
        /// 设备
        /// </summary>
        public string DeviceInfo { get; set; }


    }
}